import { View } from "../../../../mvc/core/View";
import { ObjCreate } from "../../common/ObjCreate";
import { ImagesConst } from "../../../resource/ImagesConst";
import { Language } from "../../../../../extend/language/Language";
import { GTextFormat } from "../../../../common/GTextFormat";
import { FontUtil } from "../../../../common/font/FontUtil";
import { DefInfo } from "../../../resource/info/DefInfo";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { ScaleBitmap } from "../../../../../com/mui/display/ScaleBitmap";
//class CASCBossIntroView
    
    export  class CASCBossIntroView extends View
    {
        constructor()
        {
            super();
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            this._bg = ObjCreate.createBg(0, 0, 275, 250, this, ImagesConst.ToolTipBg);
            var loc1=ObjCreate.createGButton("", 253, 2, 19, 19, this, "CloseButton");
            loc1.focusEnabled = true;
            loc1.addEventListener(flash.events.MouseEvent.CLICK, this.closeBtnClickHandler);
            ObjCreate.createBg(2, 36, 265, 3, this, ImagesConst.SplitLine);
            ObjCreate.createBg(2, 73, 265, 3, this, ImagesConst.SplitLine);
            ObjCreate.createLabel(Language.getString(27610), 15, 80, 55, 20, flash.text.TextFormatAlign.LEFT, this, true, 16776960);
            this._bossName = ObjCreate.createTextField("", 108, 10, 110, 20, this, new GTextFormat(FontUtil.songtiName, 14, 6350622, true));
            this._bossIntro = ObjCreate.createTextField("", 15, 49, 220, 20, this);
            var loc2=new GTextFormat(FontUtil.songtiName, 12, 16777215);
            loc2.leading = 5;
            this._skillIntro = ObjCreate.createTextField("", 15, 105, 250, 120, this, loc2);
            this._skillIntro.wordWrap = true;
            this._skillIntro.multiline = true;
            return;
        }

        public updateBossInfo(arg1: DefInfo): void
        {
            var loc1=null;
            if (arg1) 
            {
                this._bossName.htmlText = HTMLUtil.addColor(arg1.name, "#FF00FF");
                this._bossIntro.htmlText = HTMLUtil.addColor(arg1.text1, "#00FF00");
                this._bg.height = int(arg1.text2);
                loc1 = arg1.text3;
                loc1 = loc1.replace(new RegExp("\\[", "g"), "<");
                loc1 = loc1.replace(new RegExp("\\]", "g"), ">");
                loc1 = loc1.replace(new RegExp("\\\\n", "g"), "<br>");
                this._skillIntro.htmlText = loc1;
            }
            return;
        }

        /* internal  */closeBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (this.parent) 
            {
                this.parent.removeChild(this);
            }
            return;
        }

        /* internal */ /* var */_bossName: Object /* flash.text.TextField */;

        /* internal */ /* var */_bossIntro: Object /* flash.text.TextField */;

        /* internal */ /* var */_skillIntro: Object /* flash.text.TextField */;

        /* internal */ /* var */_bg: ScaleBitmap;
    }
